//
//  KCRLCell.m
//  Golden
//
//  Created by king on 2022/11/30.
//  Copyright © 2022 KC. All rights reserved.
//

#import "KCRLCell.h"
#import "KCKit.h"

@interface KCRLCell ()

@property (weak, nonatomic) IBOutlet UILabel *nameLabel;
@property (weak, nonatomic) IBOutlet UIView *backView;
@property (weak, nonatomic) IBOutlet UIImageView *goodsImg;

@end

@implementation KCRLCell

- (void)setNameStr:(NSString *)nameStr {
    _nameStr = nameStr;
    _nameLabel.text = _nameStr;
}

- (void)setColorStr:(UIColor *)colorStr {
    _colorStr = colorStr;
    _backView.backgroundColor = colorStr;
}

- (void)setImgStr:(NSString *)imgStr {
    
    _imgStr = imgStr;
    [_goodsImg setImageWithURL:getImageUrl(_imgStr) placeholder:nil options:KCWebImageOptionSetImageWithFadeAnimation completion:^(UIImage *image, NSURL *url, KCWebImageFromType from, KCWebImageStage stage, NSError *error) {}];

}


+ (instancetype)cellWithTableView:(UITableView *)tableView {
    
    KCRLCell *cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass(self)];
    if (cell == nil) {
        cell = [[[NSBundle mainBundle]loadNibNamed:NSStringFromClass(self) owner:nil options:nil]lastObject];
    }
    cell.selectionStyle = 0;
    cell.backgroundColor = WHITE_COLOR;
    return cell;
    
}

- (void)awakeFromNib {
    [super awakeFromNib];
    self.goodsImg.layer.cornerRadius = 5;
    self.goodsImg.layer.masksToBounds = YES;
    self.backView.layer.cornerRadius = 5;
    self.backView.layer.masksToBounds = YES;
    self.nameLabel.textColor = WHITE_COLOR;
    self.nameLabel.font = SYSTEM_FONT(44);
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
